package mobi.hami.huapin.dao;

import java.util.Map;

public class CreateNoteAuditProvider {

    /**
     * 纸条审核记录多条件查询
     */
    public String selectWitchParam(Map<String, Object> parms){
        StringBuilder sb = new StringBuilder();
        sb.append("select * from create_note_audit where ");
        if(null != parms && !parms.isEmpty()){
            if(null != parms.get("comtent") && !parms.get("comtent").equals("")){
                sb.append("comtent like '%").append(String.valueOf(parms.get("comtent"))).append("%'").append(" and ");
            }
            if(null != parms.get("start_create_time") && !parms.get("start_create_time").equals("")){
                sb.append("create_time >= '").append(parms.get("start_create_time").toString()).append("' and ");
            }
            if(null != parms.get("end_create_time") && !parms.get("end_create_time").equals("")){
                sb.append("create_time <= '").append(parms.get("end_create_time").toString()).append("' and ");
            }
            if(null != parms.get("status") && !parms.get("status").equals("")){
                sb.append("status = ").append(parms.get("status")).append(" and ");
            }
            if(null != parms.get("audit_user_id") && !parms.get("audit_user_id").equals("")){
                sb.append("audit_user_id = ").append(parms.get("audit_user_id")).append(" and ");
            }
        }
        sb.append("1 = 1 ");
        sb.append("order by create_time desc");
        return sb.toString();
    }

}
